3.148 \(\int (a+b \tanh ^2(c+d x))^2 \, dx\)

Optimal. Leaf size=43 \[ -\frac {b (2 a+b) \tanh (c+d x)}{d}+x (a+b)^2-\frac {b^2 \tanh ^3(c+d x)}{3 d} \]

[Out]

(a+b)^2*x-b*(2*a+b)*tanh(d*x+c)/d-1/3*b^2*tanh(d*x+c)^3/d

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3661, 390, 206} \[ -\frac {b (2 a+b) \tanh (c+d x)}{d}+x (a+b)^2-\frac {b^2 \tanh ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tanh[c + d*x]^2)^2,x]

[Out]

(a + b)^2*x - (b*(2*a + b)*Tanh[c + d*x])/d - (b^2*Tanh[c + d*x]^3)/(3*d)

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 3661

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[(c*ff)/f, Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \left (a+b \tanh ^2(c+d x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a+b x^2\right )^2}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=\frac {\operatorname {Subst}\left (\int \left (-b (2 a+b)-b^2 x^2+\frac {(a+b)^2}{1-x^2}\right ) \, dx,x,\tanh (c+d x)\right )}{d}\\ &=-\frac {b (2 a+b) \tanh (c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}+\frac {(a+b)^2 \operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=(a+b)^2 x-\frac {b (2 a+b) \tanh (c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.75, size = 65, normalized size = 1.51 \[ \frac {\tanh (c+d x) \left (\frac {3 (a+b)^2 \tanh ^{-1}\left (\sqrt {\tanh ^2(c+d x)}\right )}{\sqrt {\tanh ^2(c+d x)}}-b \left (6 a+b \left (\tanh ^2(c+d x)+3\right )\right )\right )}{3 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tanh[c + d*x]^2)^2,x]

[Out]

(Tanh[c + d*x]*((3*(a + b)^2*ArcTanh[Sqrt[Tanh[c + d*x]^2]])/Sqrt[Tanh[c + d*x]^2] - b*(6*a + b*(3 + Tanh[c +
d*x]^2))))/(3*d)

________________________________________________________________________________________

fricas [B]  time = 0.40, size = 201, normalized size = 4.67 \[ \frac {{\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} d x + 6 \, a b + 4 \, b^{2}\right )} \cosh \left (d x + c\right )^{3} + 3 \, {\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} d x + 6 \, a b + 4 \, b^{2}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{2} - 2 \, {\left (3 \, a b + 2 \, b^{2}\right )} \sinh \left (d x + c\right )^{3} + 3 \, {\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} d x + 6 \, a b + 4 \, b^{2}\right )} \cosh \left (d x + c\right ) - 6 \, {\left ({\left (3 \, a b + 2 \, b^{2}\right )} \cosh \left (d x + c\right )^{2} + a b\right )} \sinh \left (d x + c\right )}{3 \, {\left (d \cosh \left (d x + c\right )^{3} + 3 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{2} + 3 \, d \cosh \left (d x + c\right )\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c)^2)^2,x, algorithm="fricas")

[Out]

1/3*((3*(a^2 + 2*a*b + b^2)*d*x + 6*a*b + 4*b^2)*cosh(d*x + c)^3 + 3*(3*(a^2 + 2*a*b + b^2)*d*x + 6*a*b + 4*b^
2)*cosh(d*x + c)*sinh(d*x + c)^2 - 2*(3*a*b + 2*b^2)*sinh(d*x + c)^3 + 3*(3*(a^2 + 2*a*b + b^2)*d*x + 6*a*b +
4*b^2)*cosh(d*x + c) - 6*((3*a*b + 2*b^2)*cosh(d*x + c)^2 + a*b)*sinh(d*x + c))/(d*cosh(d*x + c)^3 + 3*d*cosh(
d*x + c)*sinh(d*x + c)^2 + 3*d*cosh(d*x + c))

________________________________________________________________________________________

giac [B]  time = 0.14, size = 103, normalized size = 2.40 \[ \frac {3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} {\left (d x + c\right )} + \frac {4 \, {\left (3 \, a b e^{\left (4 \, d x + 4 \, c\right )} + 3 \, b^{2} e^{\left (4 \, d x + 4 \, c\right )} + 6 \, a b e^{\left (2 \, d x + 2 \, c\right )} + 3 \, b^{2} e^{\left (2 \, d x + 2 \, c\right )} + 3 \, a b + 2 \, b^{2}\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{3}}}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c)^2)^2,x, algorithm="giac")

[Out]

1/3*(3*(a^2 + 2*a*b + b^2)*(d*x + c) + 4*(3*a*b*e^(4*d*x + 4*c) + 3*b^2*e^(4*d*x + 4*c) + 6*a*b*e^(2*d*x + 2*c
) + 3*b^2*e^(2*d*x + 2*c) + 3*a*b + 2*b^2)/(e^(2*d*x + 2*c) + 1)^3)/d

________________________________________________________________________________________

maple [B]  time = 0.02, size = 144, normalized size = 3.35 \[ -\frac {b^{2} \left (\tanh ^{3}\left (d x +c \right )\right )}{3 d}-\frac {2 a b \tanh \left (d x +c \right )}{d}-\frac {b^{2} \tanh \left (d x +c \right )}{d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) a^{2}}{2 d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) a b}{d}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right ) b^{2}}{2 d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) a^{2}}{2 d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) a b}{d}+\frac {\ln \left (1+\tanh \left (d x +c \right )\right ) b^{2}}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tanh(d*x+c)^2)^2,x)

[Out]

-1/3*b^2*tanh(d*x+c)^3/d-2*a*b*tanh(d*x+c)/d-b^2*tanh(d*x+c)/d-1/2/d*ln(tanh(d*x+c)-1)*a^2-1/d*ln(tanh(d*x+c)-
1)*a*b-1/2/d*ln(tanh(d*x+c)-1)*b^2+1/2/d*ln(1+tanh(d*x+c))*a^2+1/d*ln(1+tanh(d*x+c))*a*b+1/2/d*ln(1+tanh(d*x+c
))*b^2

________________________________________________________________________________________

maxima [B]  time = 0.33, size = 114, normalized size = 2.65 \[ \frac {1}{3} \, b^{2} {\left (3 \, x + \frac {3 \, c}{d} - \frac {4 \, {\left (3 \, e^{\left (-2 \, d x - 2 \, c\right )} + 3 \, e^{\left (-4 \, d x - 4 \, c\right )} + 2\right )}}{d {\left (3 \, e^{\left (-2 \, d x - 2 \, c\right )} + 3 \, e^{\left (-4 \, d x - 4 \, c\right )} + e^{\left (-6 \, d x - 6 \, c\right )} + 1\right )}}\right )} + 2 \, a b {\left (x + \frac {c}{d} - \frac {2}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a^{2} x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c)^2)^2,x, algorithm="maxima")

[Out]

1/3*b^2*(3*x + 3*c/d - 4*(3*e^(-2*d*x - 2*c) + 3*e^(-4*d*x - 4*c) + 2)/(d*(3*e^(-2*d*x - 2*c) + 3*e^(-4*d*x -
4*c) + e^(-6*d*x - 6*c) + 1))) + 2*a*b*(x + c/d - 2/(d*(e^(-2*d*x - 2*c) + 1))) + a^2*x

________________________________________________________________________________________

mupad [B]  time = 1.24, size = 47, normalized size = 1.09 \[ x\,\left (a^2+2\,a\,b+b^2\right )-\frac {b^2\,{\mathrm {tanh}\left (c+d\,x\right )}^3}{3\,d}-\frac {b\,\mathrm {tanh}\left (c+d\,x\right )\,\left (2\,a+b\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tanh(c + d*x)^2)^2,x)

[Out]

x*(2*a*b + a^2 + b^2) - (b^2*tanh(c + d*x)^3)/(3*d) - (b*tanh(c + d*x)*(2*a + b))/d

________________________________________________________________________________________

sympy [A]  time = 0.32, size = 68, normalized size = 1.58 \[ \begin {cases} a^{2} x + 2 a b x - \frac {2 a b \tanh {\left (c + d x \right )}}{d} + b^{2} x - \frac {b^{2} \tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac {b^{2} \tanh {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tanh ^{2}{\relax (c )}\right )^{2} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tanh(d*x+c)**2)**2,x)

[Out]

Piecewise((a**2*x + 2*a*b*x - 2*a*b*tanh(c + d*x)/d + b**2*x - b**2*tanh(c + d*x)**3/(3*d) - b**2*tanh(c + d*x
)/d, Ne(d, 0)), (x*(a + b*tanh(c)**2)**2, True))

________________________________________________________________________________________